package com.bilibili.bmibmr;

import java.util.Scanner;

public class bmibmr {
    public static void main(String[] args) {


        Scanner user = new Scanner(System.in);
        System.out.println("请输入你的年龄:");
        int age = user.nextInt();
        System.out.println("请输入你的性别：（男/女）");
        String sex = user.next();
        System.out.println("请输入你的身高:");
        double height = user.nextDouble();
        System.out.println("请输入你的体重:");
        double weight = user.nextDouble();


        double BMI = forBMI(height,weight);
        double BMR = forBMR(age,sex,height,weight);

        print(BMI,BMR);

    }

    public static double forBMI(double height,double weight){
        return weight/(height*height);
    }

    public static double forBMR(int age , String sex , double height , double weight ){
        double BMR;
        if("男".equals(sex))
        {
            BMR=66+(13.75*weight)+(5*height)-(6.75*age);
        }
        else
        {
            BMR=655+(9.56*weight)+(1.85*height)-(4.68*age);
        }
        return BMR ;
    }
    public static void print(double BMI , double BMR){
        System.out.println("你的BMI是："+ BMI);
        System.out.println("你的BMR是："+ BMR);
    }
}
